<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta charset="utf-8">
    <title>已入住</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/AdminLTE.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagination.css">
    <script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/js/pagination.js"></script>
    <script src="${pageContext.request.contextPath}/js/my.js"></script>
</head>

<body class="hold-transition skin-red sidebar-mini">
<!-- .box-body -->
<div class="box-header with-border">
    <h3 class="box-title">已入住</h3>
</div>
<div class="box-body">
    <!--工具栏 数据搜索 -->
    <div class="box-tools pull-right">
        <div class="has-feedback">
            <form action="${pageContext.request.contextPath}/searchBorrowed" method="post">
                房间号：<input name="roomname" value="${search.roomname}">&nbsp&nbsp&nbsp&nbsp
                入住姓名：<input name="tenement" value="${search.tenement}">&nbsp&nbsp&nbsp&nbsp
                价格：<input name="price" value="${search.price}">&nbsp&nbsp&nbsp&nbsp
                <input class="btn btn-default" type="submit" value="查询">
            </form>
        </div>
    </div>
    <!--工具栏 数据搜索 /-->
    <!--数据列表-->
    <div class="table-box">
        <!-- 数据表格 -->
        <table id="dataList" class="table table-bordered table-striped table-hover dataTable text-center">
            <thead>
            <tr>
                <th class="sorting_asc">房间号</th>
                <th class="sorting">房间价格</th>
                <th class="sorting">入住姓名</th>
                <th class="sorting">年龄</th>
                <th class="sorting">房间状态</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${pageResult}" var="room">
                <tr>
                    <td>${room.roomname}</td>
                    <td>${room.price}</td>
                    <td>${room.tenement}</td>
                    <td>${room.age}</td>
                    <td>
                        <c:if test="${room.status ==1}">入住中</c:if>
                    </td>
                    <td class="text-center">
                        <c:if test="${room.status ==1}">
                            <button type="button" class="btn bg-olive btn-xs" onclick="returnRoom(${room.id})">退房
                            </button>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
        <!-- 数据表格 /-->
        <%--分页插件--%>
        <div id="pagination" class="pagination"></div>
    </div>
    <!-- 数据表格 /-->
</div>
<!-- /.box-body -->
</body>
<script>
    /*分页插件展示的总页数*/
    pageargs.total = Math.ceil(${myTotal}/${myPageSize})
    pageargs.pagesize= ${myPageSize}
        /*分页插件当前的页码*/
        pageargs.cur = ${pageNum}
            /*分页插件页码变化时,当点击下一页时，将跳转到的服务器端的路径*/
            pageargs.gourl = "${gourl}"
    /*保存搜索框中的搜索条件，页码变化时携带之前的搜索条件*/
    roomVO.roomname = "${search.roomname}"
    roomVO.tenement = "${search.tenement}"
    roomVO.price = "${search.price}"
    /*分页效果*/
    pagination(pageargs);
</script>
</html>